import {createAsyncThunk, createSlice} from "@reduxjs/toolkit";
import {reqGetActivityList} from "../../api/frontDesk/frontDeskApi";

//获取到活动列表基础信息
export const getActivityList = createAsyncThunk(
    'article/getActivityList',
    async (page) => {
        const result = await reqGetActivityList(page)
        console.log(result.data)
        const {data} = result
        return data
    }
)

const activitySlice = createSlice({
    name: 'activity',
    initialState: {
        activityList: [],
    },
    reducers: {},
    extraReducers: builder => {
        builder.addCase(getActivityList.fulfilled, (state, action) => {
            state.activityList = action.payload
        })
    }
})

export const {reducer: activityReducer} = activitySlice